package model.po;

import java.sql.Timestamp;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

public class Order {
    private Integer id;
    private Integer userId;
    private String nickname;
    private String recipient;
    private String address;
    private String phone;
    private String goods;
    private Integer goodsId;
    private String spec;
    private Integer specId;
    private Integer number;
    private Double amount;
    private Integer state;
    private Timestamp createtime;
    private Timestamp updatetime;
    private Integer hasComment;

    public static final Map<String, String> MAPFROM;
    static { //用于ResultSetHandler，处理表字段名与对象成员名不一致的情况
        Map<String, String> tmp = new HashMap<>();
        tmp.put("user_id", "userId");
        tmp.put("goods_id", "goodsId");
        tmp.put("spec_id", "specId");
        tmp.put("has_comment", "hasComment");
        MAPFROM = Collections.unmodifiableMap(tmp);
    }

    public Order(){}

    public Order(Integer id, Integer userId, String nickname, String recipient, String address, String phone, String goods, Integer goodsId, String spec, Integer specId, Integer number, Double amount, Integer state, Timestamp createtime, Timestamp updatetime, Integer hasComment) {
        this.id = id;
        this.userId = userId;
        this.nickname = nickname;
        this.recipient = recipient;
        this.address = address;
        this.phone = phone;
        this.goods = goods;
        this.goodsId = goodsId;
        this.spec = spec;
        this.specId = specId;
        this.number = number;
        this.amount = amount;
        this.state = state;
        this.createtime = createtime;
        this.updatetime = updatetime;
        this.hasComment = hasComment;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getUserId() {
        return userId;
    }

    public void setUserId(Integer userId) {
        this.userId = userId;
    }

    public String getNickname() {
        return nickname;
    }

    public void setNickname(String nickname) {
        this.nickname = nickname;
    }

    public String getRecipient() {
        return recipient;
    }

    public void setRecipient(String recipient) {
        this.recipient = recipient;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getGoods() {
        return goods;
    }

    public void setGoods(String goods) {
        this.goods = goods;
    }

    public Integer getGoodsId() {
        return goodsId;
    }

    public void setGoodsId(Integer goodsId) {
        this.goodsId = goodsId;
    }

    public String getSpec() {
        return spec;
    }

    public void setSpec(String spec) {
        this.spec = spec;
    }

    public Integer getSpecId() {
        return specId;
    }

    public void setSpecId(Integer specId) {
        this.specId = specId;
    }

    public Integer getNumber() {
        return number;
    }

    public void setNumber(Integer number) {
        this.number = number;
    }

    public Double getAmount() {
        return amount;
    }

    public void setAmount(Double amount) {
        this.amount = amount;
    }

    public Integer getState() {
        return state;
    }

    public void setState(Integer state) {
        this.state = state;
    }

    public Timestamp getCreatetime() {
        return createtime;
    }

    public void setCreatetime(Timestamp createtime) {
        this.createtime = createtime;
    }

    public Timestamp getUpdatetime() {
        return updatetime;
    }

    public void setUpdatetime(Timestamp updatetime) {
        this.updatetime = updatetime;
    }

    public Integer getHasComment() {
        return hasComment;
    }

    public void setHasComment(Integer hasComment) {
        this.hasComment = hasComment;
    }

    @Override
    public String toString() {
        return "Order{" +
                "id=" + id +
                ", userId=" + userId +
                ", nickname='" + nickname + '\'' +
                ", recipient='" + recipient + '\'' +
                ", address='" + address + '\'' +
                ", phone='" + phone + '\'' +
                ", goods='" + goods + '\'' +
                ", goodsId=" + goodsId +
                ", spec='" + spec + '\'' +
                ", specId=" + specId +
                ", number=" + number +
                ", amount=" + amount +
                ", state=" + state +
                ", createtime=" + createtime +
                ", updatetime=" + updatetime +
                ", hasComment=" + hasComment +
                '}';
    }
}
